const {
  createProxyMiddleware
} = require('http-proxy-middleware');

module.exports = function (app) {
  app.use(
    '/api',
    createProxyMiddleware({
      //目标地址
      target: 'http://127.0.0.1',
      //伪装身份为目标地址
      changeOrigin: true,
      //去掉前缀
      pathRewrite: {
        '^/api': ''
      }
    })
  )
}